<?php


namespace app\manage\controller;


use app\manage\model\Banner as BannerModel;

class Banner extends Base
{
    public function index($page = 1, $size = 15)
    {
        $pager = BannerModel::getAll($page, $size);
        $banners = $pager->toArray();
        print_r($banners);die;
        $this->assign('banners', $banners);
        return $this->fetch('banner/index', ['menu' => $this->menu]);
    }

    public function create()
    {
        if($this->request->isPost()){
            $data = $this->request->param();
            $category = new BannerModel();
            $category->allowField(true)->isUpdate(false)->save($data);
            $this->redirect('category/index');
        }
        $categories = BannerModel::getAll();
        $this->assign('categories', $categories);
        return $this->fetch('category/create');
    }

    public function detail($id)
    {
        // TODO: Implement detail() method.
    }

    public function edit($id)
    {
        // TODO: Implement edit() method.
    }

    public function delete($id)
    {
        // TODO: Implement delete() method.
    }
}